1. /* slftctbl.cpp by K.Tsuru */
  2. // function ID 4105 DRADIX
  3. /**********************************************
  4. SLong class
  5. It makes a table of tangent coefficients T[n]
  6. using the arithmetic of SInteger class.
  7. T[0] = 0, T[n] = Tn (n>0)
  8. **********************************************/
  9. #ifndef SN_H
  10. #include "sn.h"
  11. #endif
  12. void TanCoeffTable(SNBlock <SLong>& T, uint N){
  13. SNBlock <SInteger> t(2*N+1);
  14. T.reserve(N);
  15. int err = (t.Error() != t.NORMAL) || (T.Error() != T.NORMAL);
  16. if(err) t[0].SetError(t[0].OUT_OF_RANGE,"TanCoeffTable", 7101);
  17. uint i, n;
  18. T[0].SetZero();
  19. for(i = 0; i <= 2*N; i++) t[i].SetZero();
  20. t[1].SetLong(1);
  21. for(n = 2; n <= 2*N; n++){
  22. for(i = 1; i< n; i++) IsMult(t[i], i, t[i-1]);
  23. t[n-1].SetZero();
  24. for(i = n; i >= 2; i--) IIAdd(t[i], t[i-2], t[i]);
  25. if(n % 2 == 0) T[n/2] = t[0].ConvToDec(); // radix conversion
  26. }
  27. }

slftctbl.cpp : last modifiled at 2015/11/27 14:08:19(884 bytes)
created at 2017/10/07 10:26:50
The creation time of this html file is 2017/11/09 14:52:03 (Thu Nov 09 14:52:03 2017).